home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-04-21 | 1.4 KB | 55 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWPlatMe.cpp
- // Release Version: $ 1.0d1 $
- //
- // Creation Date: 3/28/94
- //
- // Copyright: © 1993, 1994 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWPLATME_H
- #include <FWPlatMe.h>
- #endif
-
- //========================================================================================
- // Global function definitions
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // PlatformAllocateBlock
- //----------------------------------------------------------------------------------------
-
- void *PlatformAllocateBlock(size_t size)
- {
- OSErr err;
-
- FW_PlatformHandle handle = ::TempNewHandle(size, &err);
- if (err == noErr)
- {
- ::HLock(handle);
- if (MemError() == noErr)
- {
- return *handle;
- }
- }
-
- return 0;
- }
-
- //----------------------------------------------------------------------------------------
- // PlatformFreeBlock
- //----------------------------------------------------------------------------------------
-
- void PlatformFreeBlock(void *ptr)
- {
- FW_PlatformHandle handle = ::RecoverHandle((Ptr) ptr);
- if (handle)
- {
- ::HUnlock(handle);
- if (MemError() == noErr)
- DisposeHandle(handle);
- }
- }
-